package rifa.persistence.dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import rifa.entidade.Rifa;

public class RifaDao {
	
	private EntityManagerFactory fabrica;
	
	public RifaDao(){
		this.fabrica = Persistence.createEntityManagerFactory("rifa");
	}
	
	public EntityManagerFactory getFabrica(){
		return fabrica;
	}
	
	public Rifa buscarRifa(Long id){
		EntityManager gerente = fabrica.createEntityManager();
		return gerente.find(Rifa.class, id);
	}
}